(FYI - this is a newbie question I am sure; I've done only a little DXL coding involving DBs & DBEs) |
Re: apply() verses button() DB db = null void doClose(DB db) { hide(db) destroy(db) db = null } void doHelp(DB db) { infoBox("Help!") } db = create("test") // hide the default close button which always appears on the far right // note that the callback is necessary for the X icon to work close(db, false, doClose) // create your own buttons - these appear left to right as created apply(db, "my close", doClose) apply(db, "my help", doHelp) realize db show db |
Re: apply() verses button() Tony_Goodman - Fri Feb 27 04:31:07 EST 2009 button() creates a dialog box element that happens to be a button. Callback to this takes a DBE parameter. |
Re: apply() verses button() |
Re: apply() verses button() SystemAdmin - Fri Feb 27 04:37:50 EST 2009 Regards, Strathglass. |
Re: apply() verses button() strathglass - Fri Feb 27 07:48:04 EST 2009 Lets take a close peak at the DXL manual for these commands: 1) DBE apply(DB box, string label, void callback(DB)) 2) DBE button(DB box, string label, void callback(DBE)) ) 3) DBE button(DB box, string label, void callback [, bool variableSize | int style , int width] ) First off; golly I didn't know apply returned a DBE. Wonder what you could do with that. Tried moving it left but it didn't work. In 1), the label is optional but the button is far too small without a label to be practical. The 3rd paramater says it must be a function with a no return value (void), and that function must have a parameter of type DB. Not sure what you can do with that input DB parameter, unless your script has multiple boxes and you code a single callback for the boxes, and you need to figure out which one was pushed. In 2) the 3rd parameter callback function must be void and have parameter DBE; and you can have some additional sizing parameters. The input DBE is the handle of the button when its pushed, which you can use to have a single callback distinquish which button was pushed (however, routinely the callback is written for a particular button and therefore 'knows' which button it is, and ignores the parameter). In 3) we see that 'button' can have another 'width' parameter, and that it doesn't really need the DBE parameter. Turns out that's a misprint, the callback must have a DBE parameter. 2) and 3) also have a misprint, the label is also optional like in 1). So, your first adventure into reading the manual reveals lots of typos, but there you go. >Louie |